Skip to content

Conversation

@Joschua-Conrad
Copy link

@Joschua-Conrad Joschua-Conrad commented Oct 10, 2025

First of all: I love working with CQ, thank you for maintaining this library!

Plane supports conversion between local/global coordinate systems, and Location supports chaining coordinate-system offsets.
So I from time to time want to convert between them.
However, while there is a Location.__init__ from Plane and a Location.plane property, I did not find an implementation of the opposite conversion.
This PR adds this conversion from Location to Plane.

Some things I ask the reviewers to notice and possibly discuss:

  • I tried using @multimethod on Plane.__init__. But that then disallows passing keyword arguments to the constructor, and that is needed in existing code. Using @multidispatch produces working code, but Sphinx docs do not support it. So I left Plane.__init__ untouched and added a Plane.fromLocation class-method.
  • The Location.plane property I added is analogous to Plane.location.
  • I did not find a test of geom.py, so I added test_geom.py. The new test creates a Plane and then runs through a chain of conversions Plane -> Location -> Plane -> Location. In the end, there are two Planes and two Locations, which have to be equal, respectively. This is asserted, along with origin and rotations of the first created Location.
  • pytest, build_docs.sh, and black all pass, and yield the same warnings as on the master branch.

I'm excited about your feedback!

Otherwise creating of Plane from tuple of int does not work anymore due to introduced @multimethod
Instead of just creating a temporary plane and rotating it
multimethod did not work, as that disallows keyword arguments for construction of Plane, which ruins many tests
multidispatch works with keyword arguments, but looks horrible in docs
Construction from class method just works.
@codecov
Copy link

codecov bot commented Oct 10, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.75%. Comparing base (dadf151) to head (8d8c2f5).
⚠️ Report is 2 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1912   +/-   ##
=======================================
  Coverage   95.74%   95.75%           
=======================================
  Files          29       29           
  Lines        7827     7845   +18     
  Branches     1179     1179           
=======================================
+ Hits         7494     7512   +18     
  Misses        192      192           
  Partials      141      141           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Joschua-Conrad Joschua-Conrad marked this pull request as ready for review October 10, 2025 08:54
Copy link
Member

@jmwright jmwright left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @Joschua-Conrad , I like the thorough commenting. I asked a question and made a couple inline suggestions, but otherwise it looks good.

Joschua-Conrad and others added 2 commits October 22, 2025 13:22
Co-authored-by: Jeremy Wright <wrightjmf@gmail.com>
Co-authored-by: Jeremy Wright <wrightjmf@gmail.com>
@Joschua-Conrad
Copy link
Author

Thanks @Joschua-Conrad , I like the thorough commenting. I asked a question and made a couple inline suggestions, but otherwise it looks good.

Thank you for the review and for fixing my spelling mistakes!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants